package com.levi.jucpratice.第三章;

import java.util.Hashtable;

/**
 * @author shentong
 * @since 2022/12/5 13:51
 */
public class VolatileTest {
    private static volatile boolean asleep = false;

    public static void main(String[] args) throws InterruptedException {

        new Thread(() -> {
            while (!asleep) {
                System.out.println("还没有睡着");
            }
        }, "one").start();
        Hashtable<String, String> stringStringHashtable = new Hashtable<>();
        Thread.sleep(1000);
        asleep = true;
        System.out.println("睡着了");



    }
}
